Skip to content

Instantly share code, notes, and snippets.

View Luavis's full-sized avatar
🐈
meow~

Luavis Luavis

🐈
meow~
View GitHub Profile
#import <Foundation/Foundation.h>
@interface Communicator : NSObject <NSStreamDelegate> {
@public
NSString *host;
int port;
}
- (void)setup;
@Luavis
Luavis / example.py
Created April 12, 2014 13:57
python example code
#!/usr/bin/env python
"""
* Writing By Luavis
"""
# -*- coding:utf-8 -*-
import time
def date():
print (time.strftime("%H:%M:%S"))
@Luavis
Luavis / dimig.js
Created May 14, 2014 16:24
dimigo.js
'use strict';
var request = require('request')
setInterval(function() {
request.get('http://m.search.naver.com/search.naver?query=%ED%95%9C%EA%B5%AD%EB%94%94%EC%A7%80%ED%84%B8%EB%AF%B8%EB%94%94%EC%96%B4%EA%B3%A0%EB%93%B1%ED%95%99%EA%B5%90+%EC%84%A0%EC%83%9D%EB%8B%98+%EC%82%AC%EB%9E%91%ED%95%B4%EC%9A%94&where=m&sm=fbk_pin&og_title=%5B%EB%84%A4%EC%9D%B4%EB%B2%84%5D+%EA%B2%80%EC%83%89%3A+%22%ED%95%9C%EA%B5%AD%EB%94%94%EC%A7%80%ED%84%B8%EB%AF%B8%EB%94%94%EC%96%B4%EA%B3%A0%EB%93%B1%ED%95%99%EA%B5%90+%EC%84%A0%EC%83%9D%EB%8B%98+%EC%82%AC%EB%9E%91%ED%95%B4%EC%9A%94%22+%EB%82%B4%EA%B0%80+4063%EB%93%B1%21+%282014.5.15%29+%EB%82%98%EB%8A%94+%EB%AA%87+%EB%93%B1%EC%9D%BC%EA%B9%8C%3F');
}, 30000);
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define UIColorFromRGBWithAlpha(rgbValue, alpha) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alpha]
#define UINavigationBarTintColor(uicolor) \
NSArray *ver = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; \
if ([[ver objectAtIndex:0] intValue] >= 7) { \
self.navigationController.navigationBar.barTintColor = uicolor; \
self.navigationController.navigationBar.translucent = NO; \
} else { \
self.navigationController.navigationBar.tintColor = uicolor; \
@Luavis
Luavis / ds_store_remove.sh
Last active August 29, 2015 14:03 — forked from randyjhunt/gist:43184
ds_store_remove.sh
find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch
git config --global core.excludesfile ~/.gitignore
echo .DS_Store >> ~/.gitignore
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
id options = @{
ACFacebookAppIdKey: @"403376439767549",
ACFacebookPermissionsKey: @[ @"email", @"read_friendlists"],
ACFacebookAudienceKey: ACFacebookAudienceFriends
};
[accountStore requestAccessToAccountsWithType:facebookAccountType
options:options
completion:^(BOOL granted, NSError *error) {
@Luavis
Luavis / smi_srt.py
Last active August 29, 2015 14:05
pid install pycaption
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pycaption import SAMIReader, SRTWriter
import sys
import os
from chardet.universaldetector import UniversalDetector
def main():
if len(sys.argv) < 1:
@Luavis
Luavis / array-example.swift
Last active August 29, 2015 14:06
swift - array index operator subclass example
import Foundation
class TestArray {
private var array:Array<String> = ["asd", "asdf", "asdfg"]
subscript(index: Int) -> String { get {
return self.array[index]
}}
}
@Luavis
Luavis / init.sh
Created September 16, 2014 02:07
Default MacOS setting bash
#!/bin/sh
# change screenshot save folder at ~/Screenshots
mkdir -p ~/Screenshots/
defaults write com.apple.screencapture location ~/Screenshots/
killall SystemUIServer
@Luavis
Luavis / output
Last active August 29, 2015 14:06
tcp-example
$ tcpdump -qns 0 -A -r ./tcp-transfer-0-0.pcap
reading from file ./tcp-transfer-0-0.pcap, link-type PPP (PPP)
09:00:00.000000 IP 10.1.3.1.49153 > 10.1.3.2.80: tcp 0
.!E..8....@...
...
......P....................
...........
09:00:00.020079 IP 10.1.3.2.80 > 10.1.3.1.49153: tcp 0
.!E..(....@...
...