Skip to content

Instantly share code, notes, and snippets.

# Suppose we already have LXD, and already add the default image repo as images:
# 1. Start a new Trusty LXC container
host:~$ lxc launch images:ubuntu/trusty/amd64 cuda-trusty
# 2. Download and install CUDA on *both* host & LXC container, from https://developer.nvidia.com/cuda-downloads
# Note that host and container have to have *exactly* the same driver version
# 3. Add necessary Nvidia devices to LXC container
host:~$ lxc config device add cuda-trusty nvidia0 unix-char path=/dev/nvidia0
host:~$ lxc config device add cuda-trusty nvidiactl unix-char path=/dev/nvidiactl
@avescodes
avescodes / gist:e5d1acbb007f47655508
Created August 18, 2014 18:42
Great little snippet for using Postgres enum types inside clojure.java.jdbc
(defn keyword->pg-enum
"Convert a keyword value into an enum-compatible object."
[enum-type kw]
(doto (org.postgresql.util.PGobject.)
(.setType enum-type)
(.setValue (name kw))))
(def ->status
"Convert a keyword status into a something_status enum object"
(partial keyword->pg-enum "something_status"))
@adeel
adeel / push-notifications.clj
Created July 26, 2011 01:03
Example of sending Apple push notifications with Clojure.
; Depends on [com.notnoop.apns/apns "0.1.6"].
(:import ('com.notnoop.apns APNS))
(defn send-push-notification [device-token message]
(let [service (.build (.withSandboxDestination
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password")))
payload (.build (.alertBody (APNS/newPayload) message))]
(.push service device-token payload)))
@mohamed
mohamed / build-gn.sh
Last active September 23, 2022 06:25
Build Google gn build tool standalone
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# https://github.com/ninja-build/ninja
# https://gn.googlesource.com/gn/
# We need a recent git
@dhlavaty
dhlavaty / downloadCSV.cs
Last active June 10, 2023 14:08
Download CSV file from Google Spreadsheet (Google Drive) using minimum c# code
using System;
using System.Net;
namespace ConsoleApplication1
{
class Program
{
public class WebClientEx : WebClient
{
public WebClientEx(CookieContainer container)
@Metaxal
Metaxal / logging.rkt
Last active September 10, 2023 09:52
Simple usage of Racket's logging facility
#lang racket/base
; One way to define a logger
(define lg (make-logger 'my-logger))
; Define a receiver for this logger, along with a log level
(define rc (make-log-receiver lg 'error)) ; also try with 'debug
; Another way to define a logger, with additional forms
(define-logger lg2)
(define rc2 (make-log-receiver lg2-logger 'debug))
@IJEMIN
IJEMIN / GoogleTranslator.cs
Last active September 13, 2023 06:51
Simple Unity Google Translator
/* Credit */
// Inspired by grimmdev's code - https://gist.github.com/grimmdev/979877fcdc943267e44c
/* Dependency */
// Import SimpleJSON Scripts : http://wiki.unity3d.com/index.php/SimpleJSON
// You can use your own JSON Parser if you want.
/* Limitations */
// translate.googleapis.com is free, but it only allows about 100 requests per one hour.
// After that, you will receive 429 error response.
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@jzayed
jzayed / GlowLevels.shader
Created May 11, 2018 10:51
Glow Levels Shader
Shader "Sprites/GlowLevels"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_AlphaIntensity_Fade_1("_AlphaIntensity_Fade_1", Range(0, 3)) = 1
_TintRGBA_Color_1("_TintRGBA_Color_1", COLOR) = (1,1,1,1)
_AlphaIntensity_Fade_2("_AlphaIntensity_Fade_2", Range(0, 3)) = 1
_TintRGBA_Color_2("_TintRGBA_Color_2", COLOR) = (1,1,1,1)

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"