Skip to content

Instantly share code, notes, and snippets.

View njpatel's full-sized avatar
📞
Were you really going to call me?

Neil Jagdish Patel njpatel

📞
Were you really going to call me?
View GitHub Profile
@njpatel
njpatel / Go Mindfuck.go
Created July 20, 2012 10:25
Go Mindfuck
func readLogData(filename string, log_id int, logOutputChan chan<- *LogTuple, deathChan chan<- *string) {
cmd := exec.Command("tail", "-f", filename)
stdout, err := cmd.StdoutPipe()
if err != nil {
log.Fatal(err)
}
if err := cmd.Start(); err != nil {
log.Fatal(err)
}
@njpatel
njpatel / fix-drawing.diff
Created August 17, 2012 11:23
Fixes drawing of previews
=== modified file 'dash/DashView.cpp'
--- dash/DashView.cpp 2012-08-16 14:38:33 +0000
+++ dash/DashView.cpp 2012-08-16 22:12:13 +0000
@@ -381,13 +381,6 @@
void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
{
renderer_.DrawFull(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry());
-
- // we only do this because the previews don't redraw correctly right now, so we have to force
- // a full redraw every frame. performance sucks but we'll fix it post FF
/home/njpatel/Projects/unity/plugins/unityshell/src/unityshell.cpp: In member function ‘virtual void unity::UnityScreen::handleEvent(XEvent*)’:
/home/njpatel/Projects/unity/plugins/unityshell/src/unityshell.cpp:1408:52: error: ‘class ScaleScreen’ has no member named ‘getSelectedWindow’
/home/njpatel/Projects/unity/plugins/unityshell/src/unityshell.cpp:1421:52: error: ‘class ScaleScreen’ has no member named ‘getSelectedWindow’
/home/njpatel/Projects/unity/plugins/unityshell/src/unityshell.cpp:1455:52: error: ‘class ScaleScreen’ has no member named ‘getSelectedWindow’
/home/njpatel/Projects/unity/plugins/unityshell/src/unityshell.cpp: In member function ‘virtual void unity::UnityWindow::scalePaintDecoration(const GLWindowPaintAttrib&, const GLMatrix&, const CompRegion&, unsigned int)’:
/home/njpatel/Projects/unity/plugins/unityshell/src/unityshell.cpp:3617:33: error: ‘class ScaleScreen’ has no member named ‘getSelectedWindow’
make[2]: *** [plugins/unityshell/CMakeFiles/unityshell.dir/src/unityshell.cpp.o] Error
Linking CXX shared library libunityshell.so
../../launcher/liblauncher-lib.a(DNDCollectionWindow.cpp.o):(.data.rel.ro._ZTVN5unity19DNDCollectionWindowE[_ZTVN5unity19DNDCollectionWindowE]+0x1e8): undefined reference to `nux::InputArea::SetBaseString(char const*)'
../../launcher/liblauncher-lib.a(Launcher.cpp.o):(.data.rel.ro._ZTVN5unity8launcher8LauncherE[_ZTVN5unity8launcher8LauncherE]+0x2d8): undefined reference to `nux::InputArea::SetBaseString(char const*)'
../../launcher/liblauncher-lib.a(LauncherDragWindow.cpp.o):(.data.rel.ro._ZTVN5unity8launcher18LauncherDragWindowE[_ZTVN5unity8launcher18LauncherDragWindowE]+0x1e8): undefined reference to `nux::InputArea::SetBaseString(char const*)'
../../launcher/liblauncher-lib.a(QuicklistMenuItem.cpp.o):(.data.rel.ro._ZTVN5unity17QuicklistMenuItemE[_ZTVN5unity17QuicklistMenuItemE]+0x1e8): undefined reference to `nux::InputArea::SetBaseString(char const*)'
../../launcher/liblauncher-lib.a(QuicklistMenuItemCheckmark.cpp.o):(.data.rel.ro._ZTVN5unity26QuicklistMenuItemC
@njpatel
njpatel / setup-env.sh
Created September 17, 2012 12:31
setup-env.sh
#!/bin/bash
export PATH=/home/njpatel/build/bin:$PATH
export LD_LIBRARY_PATH=/home/njpatel/build/lib:/usr/local/lib:/usr/lib
export PKG_CONFIG_PATH=/home/njpatel/build/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
export XDG_DATA_DIRS=/home/njpatel/build/share:/usr/local/share:/usr/share:$XDG_DATA_DIRS
section: screens
scar-win:
sarafinia:
end
section: links
scar-win:
down = sarafinia
sarafinia:
up = scar-win
@njpatel
njpatel / rps.js
Created October 2, 2013 15:26
RockPaperAaron.js
var options = [ "rock", "paper", "scissors" ];
var results = [ "wins!", "loses!", "draws!" ];
var compare = {
rock: {
rock: 2,
paper: 0,
scissors: 1
},
paper: {
@njpatel
njpatel / tmux.conf
Created January 2, 2014 20:40
tmux.conf
set-option -g prefix C-a
unbind C-b
bind-key C-a send-prefix
set -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
set-option -g status-utf8 on
@njpatel
njpatel / etc-salt-reactor
Created January 24, 2014 19:00
Fun with salt, basically running scripts on master when events are fired via the Reactor system. The names of the files are paths with - replacing /
<contents of normal file>
# Add any additional locations to look for master runners
runner_dirs: [/srv/runners]
# Register a reactor whenever a cloud provider emits 'created'
# the * is the name of the VM, we want any, but you could
# do something like salt/cloud/Webservers-*/created if you only
# wanted your webservers
reactor:
func (installer BkInstaller) Run() ) (err error) {
installer.log("Start installer bk")
err = installer.createTables()
if err == nil {
err = installer.stateIndex()
if err == nil {
err = installer.stateRelations()
}
}