Skip to content

Instantly share code, notes, and snippets.

Felix Oghină foghina

View GitHub Profile
import socket
import struct
import time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('', 27007))
s.send(b'\x43\x52\x57\x48\x01'.ljust(128, b'\0'))
data = s.recv(132)
(len_response,) = struct.unpack('12xi', data[:16])
data = s.recv(len_response)
  • [46dc46a] changes when we clear the current activity from the ReactContext: moved it from onPause to onDestroy. This is generally good news, as you have access to the Activity in more situations, but if you were relying on the Activity being null in paused state, you'll need to change your code.
  • [0b5c612] changes how we forward Activity lifecycle events to listeners: we no longer send events generated by background Activities. The biggest implication of this is probably that, if you are using multiple React Activities, won't receive onHostDestroy() until the last React Activity is destroyed. Furthermore, if you're writing your own custom activities, make sure to call the new API (ReactInstanceManager#onHostPause(Activity) and co.) to benefit from this.
  • [3c4fd42] adds a FragmentActivity-based React Activity class, to support using libraries that rely on this. In order to achieve DRY, most of the Activity methods (onCreate, getReactNativeHost etc.) are now delegated to `ReactAc
# Set up a new A record in Cloudflare, add the details of it along with your account details below
# Make sure this script runs on startup (or whenever you get a new IP...)
# Updated for Python 3.
# @author Aaron Rice <>
# @author Felix Oghină <>
View gist:5336270
PS1='\[\033[1;32m\]\w`__git_ps1`€\[\033[0m\] '
foghina /
Last active Oct 12, 2015
Video Surveillance in Bash
FFMPEG_INPUT_FLAGS="-rtsp_transport tcp"
FFMPEG_OUTPUT_FLAGS="-r 20 -acodec libspeex"
CLIP_LENGTH=600 # seconds
TIMELIMIT=620 # seconds, allows for network timeout over CLIP_LENGTH
KEEP_FILES_FOR=10080 # minutes
foghina / sublime-text.desktop
Created Sep 18, 2012
Sublime Text 2 .desktop file
View sublime-text.desktop
# ~/.local/share/applications/sublime-text.desktop
[Desktop Entry]
Exec=/opt/sublime/sublime_text %U
Name=Sublime Text 2
Comment=Sublime Text is a sophisticated text editor for code, html and prose. You'll love the slick user interface and extraordinary features.
foghina / gist:1206035
Created Sep 9, 2011
Sublime Text 2 Failed Snippet
View gist:1206035
{ "keys": ["ctrl+shift+i"], "command": "insert_snippet", "args": {"contents": "I18n.t($SELECTION)"}, "context":
{"key": "scope", "operator": "regex_contains", "operand": "ruby", "match_all": true }
You can’t perform that action at this time.