Skip to content

Instantly share code, notes, and snippets.

View Teqqles's full-sized avatar

David Long Teqqles

View GitHub Profile
@Geoyi
Geoyi / install virtualenv ubuntu 16.04.md
Created September 16, 2017 12:19 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@mufasa71
mufasa71 / fehbg
Created April 1, 2017 09:25
show weather with random wallpaper using feh and wttr.in
#!/bin/sh
$(convert ~/Pictures/Wallpapers/$(ls ~/Pictures/Wallpapers|shuf -n 1) <(curl wttr.in/Tashkent_tgp0.png) -geometry +50+50 -composite /tmp/wallpaper.jpg && feh --bg-fill /tmp/wallpaper.jpg)&
@sahilsk
sahilsk / kafka-cheat-sheet.md
Last active April 12, 2024 01:27 — forked from filipefigcorreia/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
@Bunyod
Bunyod / Entities.scala
Created October 27, 2016 07:27
Slick one to many and grouping
object Entities {
case class Review(txt: String, userId: Long, id: Long)
case class User(name: String, id: Long)
case class ReviewEvent(event: String, reviewId: Long)
case class FullReview(r: Review, user: User, evts: Seq[ReviewEvent])
}
@ipbastola
ipbastola / jq to filter by value.md
Last active April 25, 2024 17:14
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@bitkidd
bitkidd / deleting_tons_of_files_in_linux.md
Last active August 14, 2018 13:59
Deleting tons of files in Linux (Argument list too long)

If you’re trying to delete a very large number of files at one time (I deleted a directory with 485,000+ today), you will probably run into this error:

/bin/rm: Argument list too long.

The problem is that when you type something like “rm -rf ”, the “” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a reletively small buffer of memory allocated to storing this list of arguments and if it is filled up, the shell will not execute the program. To get around this problem, a lot of people will use the find command to find every file and pass them one-by-one to the “rm” command like this:

find . -type f -exec rm -v {} \;

My problem is that I needed to delete 500,000 files and it was taking way too long.

@fadookie
fadookie / CameraAnchor.cs
Last active April 29, 2024 12:19
Screen-relative anchoring component for Unity3D. Find more Unity code at http://www.eliotlash.com/2015/01/unity3d-components-and-code-snippets/
/***
* This script will anchor a GameObject to a relative screen position.
* This script is intended to be used with ViewportHandler.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623
* It is also copied in this gist below.
*
* Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts.
* You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader.
*/
/* The MIT License (MIT)

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@stefanborghys
stefanborghys / drop_trigger_changelog.xml
Last active March 11, 2016 16:20
Drop a trigger from an Oracle database using Liquibase (http://www.liquibase.org).
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../xsd/dbchangelog-2.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../xsd/dbchangelog-ext.xsd"
logicalFilePath="drop_trigger_changelog.xml">
<changeSet id="1" author="stefanborghys" runOnChange="true">
<preConditions onFail="MARK_RAN">
@lepture
lepture / gevent-flask.py
Last active January 30, 2020 15:29
gevent with werkzeug reload and debug
def runserver(port=5000, profile_log=None):
"""Runs a development server."""
from gevent.wsgi import WSGIServer
from werkzeug.serving import run_with_reloader
from werkzeug.debug import DebuggedApplication
from werkzeug.contrib.profiler import ProfilerMiddleware
port = int(port)
if profile_log: