Skip to content

Instantly share code, notes, and snippets.

View anujbhatt's full-sized avatar

Anuj Bhatt anujbhatt

  • Austin, TX
View GitHub Profile
@anujbhatt
anujbhatt / vlc-http.sh
Last active September 30, 2016 10:58
Start VLC HTTP Interface (Mac OSX)
cd /Applications/VLC.app/Contents/MacOS
./VLC --http-host localhost --http-port 4242 --http-password <password>
# then open localhost:4242 on your browser. leave username blank and enter <password> as the password
@anujbhatt
anujbhatt / log2txt.py
Created March 11, 2015 15:30
Convert a set of .log.[0-9]* log4j/log4net files to txt so it's easier to open them on a Mac
#!/usr/bin/python
if __name__ == '__main__':
import os
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
if ".log" in f:
print "renaming %s" % (f)
os.rename(f, f+".txt")
@anujbhatt
anujbhatt / restore.sql
Created August 31, 2014 10:10
Restoring a database in MS SqlServer without using the UI
-- Replace MYDB with the name of your db below
-- close existing connections
ALTER DATABASE MYDB
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE
GO
-- switch to some other db
USE master
@anujbhatt
anujbhatt / gist:9351683
Created March 4, 2014 17:42
Comparing plain values to hex representations
select email, hex(email) from users where email like "%bademail%";
@anujbhatt
anujbhatt / gist:9351645
Last active August 29, 2015 13:57
Finding records with a column which has control characters in its value
select * from users where email regexp ".*[[:cntrl:]]+.*";
@anujbhatt
anujbhatt / proto-on-mac-example.sh
Last active October 8, 2017 21:22
Generating C# classes from .proto files on a Mac
$ cat example.proto
message AMessage
{
required int32 a=1;
optional int32 b=2;
}
$ protoc example.proto --descriptor_set_out=example.pb
$ mono ProtoGen.exe example.pb
$ more Example.cs