Skip to content

Instantly share code, notes, and snippets.

View Code-Hex's full-sized avatar
:shipit:
Go Travel

Kei Kamikawa Code-Hex

:shipit:
Go Travel
View GitHub Profile
@kitasuke
kitasuke / StringExtension.swift
Created August 24, 2015 03:19
String extension in Swift for Xcode beta5
extension String {
var lastPathComponent: String {
get {
return (self as NSString).lastPathComponent
}
}
var pathExtension: String {
@JadenGeller
JadenGeller / Type Inference.c
Created April 29, 2015 03:27
C Type Inference (Let and Var)
#define let(name,value) const __typeof__ (value) name = value;
#define var(name,value) __typeof__ (value) name = value;
int main(int argc, char *argv[]) {
let(x,3); // const int x = 3;
var(y,5); // int y = 5;
printf("x:%i y:%i",x,y); // -> x:3 y:5
}
@denji
denji / golang-tls.md
Last active February 21, 2026 12:07 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@satoshin2071
satoshin2071 / gist:cc3a982b9b65dc9b8f20
Last active May 26, 2020 07:52
CoreFoundation入門 基本クラス

#CoreFoundation入門 基本クラス

##概要

Core Foundationで頻出するドキュメントにて「Derived from CFPropertyList」となっている以下の基本クラスを確認。

CFData, CFString, CFArray, CFDictionary, CFDate, CFNumber(CFBoolean)

※CFNumber、CFDate以外は上記のImutable型に対してそれぞれMutablel型が用意されている。

@Kartones
Kartones / postgres-cheatsheet.md
Last active March 31, 2026 04:12
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@yoheia
yoheia / perl_oneliner_example
Last active August 26, 2024 05:55
Perlワンライナー&マルチライナー集
Perl ワンライナーサンプル集
■概要
障害解析のためのログの調査、非互換対応でのソースコードの調査といった
テキスト処理で使った Perl ワンライナーのサンプル集です。
Perl ワンライナーは以下の点が良いと思います。
・Perl は Oracle Database (10g以降) に同梱されている。
 従って、Windows プラットフォームでも使える。
@chrismccoy
chrismccoy / gitcheats.txt
Last active March 22, 2026 20:32
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# git partial directory checkout alias
pdir = "!f() { repo=\"$1\"; dir=\"$2\"; name=$(basename \"$repo\" .git); git clone --filter=blob:none --no-checkout \"$repo\" \"$name\" && cd \"$name\" && git sparse-checkout init --no-cone && git sparse-checkout set \"$dir\" && git checkout; }; f"
# delete all repos in an org
gh repo list YOUR_ORG_NAME --limit 4000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -I {} gh repo delete {} --yes
@XVilka
XVilka / TrueColour.md
Last active March 23, 2026 05:31
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@murooka
murooka / perl_first.md
Last active March 10, 2020 23:37
Linuxでのperl環境の構築

perlの環境構築

perlbrewとperlのインストール

何はともあれまずperlbrewを入れる

\curl -L http://install.perlbrew.pl | bash
echo 'source ~/perl5/perlbrew/etc/bashrc' >> .bashrc
source .bashrc
@willurd
willurd / web-servers.md
Last active March 30, 2026 09:18
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000