Skip to content

Instantly share code, notes, and snippets.

View scturtle's full-sized avatar
🐢

scturtle

🐢
View GitHub Profile
@evansb
evansb / Parser.hs
Created August 11, 2014 11:28
3 lines Parser in Haskell (Line 9,11,12)
import Control.Monad.State.Lazy
import Control.Monad.Error
import Control.Monad.Identity
import Control.Applicative
import Data.Char
-- Begin parser
type Parser a = StateT String (ErrorT String Identity) a
@samueltardieu
samueltardieu / pell.py
Created November 26, 2010 22:47
Solve the Pell equation
"""Compute solutions to the diophantine Pell equation x^2-D*y^2=1."""
import itertools
def pell (D):
"""Return the smallest integer set solving Pell equation
x^2-D*y^2=1 where x, D and y are positive integers. If there are no
solution (D is a square), return None.
>>> pell(3)
@leoleozhu
leoleozhu / git with proxy.md
Last active December 21, 2016 15:48
use Git with proxy

install socat

sudo apt-get install socat

edit ~/.ssh/config

host github.com
    proxycommand socat - PROXY:localhost:%h:%p,proxyport=8080

###If you want to use SOCKS proxy, edit it like this. host bitbucket.org ProxyCommand socat - SOCKS:localhost:%h:%p,socksport=7070

@raichoo
raichoo / gist:01969563d1a534cf4f26
Last active July 19, 2017 17:06
Typed Interpreter in Haskell
{-# OPTIONS_GHC -Wall -fno-warn-incomplete-patterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NPlusKPatterns #-}
module Main where
@Jach
Jach / number_hack.py
Created September 10, 2011 11:44
Overrides the Python integer five to be equal to four with ctypes magic
import sys
import ctypes
pyint_p = ctypes.POINTER(ctypes.c_byte*sys.getsizeof(5))
five = ctypes.cast(id(5), pyint_p)
print(2 + 2 == 5) # False
five.contents[five.contents[:].index(5)] = 4
print(2 + 2 == 5) # True (must be sufficiently large values of 2 there...)
@tungel
tungel / my Arch Linux cheat-sheet
Created July 8, 2013 13:42
I have kind of short term memory so I like to take note of what I've done. This cheat-sheet log some of the things I've done to my Arch Linux machine. Lots of these stuffs are based on my personal preference and may not be applicable to you. Also take note that: I'm not responsible if you break your machine by following any of the steps in this …
Installing Arch:
sudo vim /etc/pacman.conf
Update packages list: sudo pacman -Syy
run sudo pacman -Syu before installing any software (to update the repositories first)
* Timing issue:
- Change hardware clock to use UTC time:
sudo timedatectl set-local-rtc 0
@beala
beala / argy.py
Created August 11, 2012 15:48
A command line argument parser using generators and co-routines.
"""
Inspired by:
http://eli.thegreenplace.net/2009/08/29/co-routines-as-an-alternative-to-state-machines/
"""
def parse_args(target):
"""A generator that parses a stream of arguments one character at a time.
As soon as a flag, or flag value pair ("-a" or "-a value") is processed
the pair is sent off as a tuple to the 'target' generator.
@folke
folke / apropos.fish
Created October 1, 2020 12:34
Using `apropos` on macos rebuilds the whatis database every time. Fish shell uses apropos for command completion.
# Fixes extremely slow apropos command on macos
# Using `apropos` on macos rebuilds the whatis database every time.
# Fish shell uses apropos for command completion.
# Simply add the file below to `~/.config/fish/conf.d` to fix the issue
set db ~/.whatis.db
function apropos_update
echo "Updating apropos / whatis database at $db"
man --path | tr ":" " " | xargs /usr/libexec/makewhatis -o $db

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

@0n3la57k155
0n3la57k155 / FUCK APPLE OCSP
Last active July 28, 2022 12:46
FUCK APPLE OCSP
127.0.0.1 ocsp-lb.apple.com.akadns.net
127.0.0.1 ocsp-cn-lb.apple.com.akadns.net
127.0.0.1 ocsp.apple.com.download.ks-cdn.com
127.0.0.1 k128-mzstatic.gslb.ksyuncdn.com
127.0.0.1 ocsp.apple.com.cdn20.com
127.0.0.1 ocsp.g.aaplimg.com
127.0.0.1 ocsp.apple.com
127.0.0.1 ocsp.digicert.com