Skip to content

Instantly share code, notes, and snippets.

View Kif11's full-sized avatar
🐁
Expanding digital frontier

Kirill Kovalevskiy Kif11

🐁
Expanding digital frontier
View GitHub Profile
@K240-zz
K240-zz / gist:1722150
Created February 2, 2012 07:19
PyQt Skelton for Maya.
'''
original from http://nathanhorne.com/?p=183
'''
import os
import sip
import maya.cmds as cmds
import maya.OpenMayaUI as mui
from PyQt4 import QtGui, QtCore, uic
def getMayaWindow():
@justinfx
justinfx / mm_pushbutton.py
Created June 14, 2013 00:28
Attaching a Maya Marking Menu to the right click of a PyQt QPushButton widget
from PyQt4 import QtCore, QtGui
import maya.cmds as cmds
import maya.OpenMayaUI as mui
import sip
def getMayaWindow():
ptr = mui.MQtUtil.mainWindow()
return sip.wrapinstance(long(ptr), QtCore.QObject)
widget = QtGui.QDialog(getMayaWindow())
@jychstar
jychstar / tensorboard_beginner.py
Created June 5, 2017 00:06
simple example to show how to use `tf.summary` to record image, scalar, histogram and graph for display in tensorboard
import argparse
import sys
from tensorflow.examples.tutorials.mnist import input_data
from time import time
t0 = time()
import tensorflow as tf
tf.summary.FileWriterCache.clear()
# Full text search
[hendry@t480s 5xx]$ cat bugzilla.sh
aws --profile uneet-dev logs filter-log-events --log-group-name bugzilla --start-time $(date -d "-1 hour" +%s000) \
--filter-pattern '"apex/ping/v1.0"'
# (faster) Query on a JSON structured log
[hendry@t480s 5xx]$ cat alambda.sh
aws --profile uneet-demo logs filter-log-events --log-group-name "/aws/lambda/alambda_simple" --start-time $(date -d "-8
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / gist:968e5ea87e99d9c41782
Created November 28, 2014 17:32
BASH Absolute path of current script
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
@vinzdef
vinzdef / bandit24-solution
Last active October 5, 2022 06:29
4 digit pin bruteforce using Bash expansions for Over The Wire bandit25
for x in {0..9}{0..9}{0..9}{0..9}; do
echo UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ $x | telnet localhost 30002 | egrep -v "Exiting|Wrong|I am";
echo "Try $x";
done
@DarthPumpkin
DarthPumpkin / tor.sh
Last active October 25, 2022 18:31
OS X shell script for routing all traffic through tor. Requires tor to be installed (brew install tor). Taken from https://kremalicious.com/simple-tor-setup-on-mac-os-x/, modified from http://leonid.shevtsov.me/en/an-easy-way-to-use-tor-on-os-x To stop using tor just terminate this script with Ctrl C
#!/usr/bin/env bash
# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet'
INTERFACE=Wi-Fi
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@crucialfelix
crucialfelix / analytics.js
Last active November 30, 2022 19:05
Google Analytics for Next.js with next/router
/**
* analytics.js;
* Copyright 2019 Chris Sattinger
* MIT license - do as thou wilt
*
* This will send page views on route change to Google Analytics.
* Works with https://nextjs.org/ and https://github.com/fridays/next-routes
**/
import Router from "next/router";
(defun jone-filter (condp lst)
(delq nil
(mapcar (lambda (x) (and (funcall condp x) x)) lst)))
(jone-filter (lambda (e) (string= e "hans")) ("hans" "peter"))
@sneha-belkhale
sneha-belkhale / Fbm.cginc
Last active March 13, 2023 13:13
Fractal Brownian Motion function to include in Unity Shader
float hash (float2 n)
{
return frac(sin(dot(n, float2(123.456789, 987.654321))) * 54321.9876 );
}
float noise(float2 p)
{
float2 i = floor(p);
float2 u = smoothstep(0.0, 1.0, frac(p));
float a = hash(i + float2(0,0));