Skip to content

Instantly share code, notes, and snippets.

Reto Kaiser njam

Block or report user

Report or block njam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View relm-gtk-app.rs
extern crate gtk;
extern crate gio;
extern crate glib;
#[macro_use]
extern crate relm;
#[macro_use]
extern crate relm_derive;
use relm::{Relm, Update, Widget};
use gio::prelude::*;
View catch.diff
diff --git a/extension.js b/extension.js
index 513b803..d2907ad 100644
--- a/extension.js
+++ b/extension.js
@@ -244,11 +244,15 @@ const FolderMenuItem = new Lang.Class({
let file = Gio.File.new_for_path(this._folder.path);
try {
icon = file.query_info('standard::symbolic-icon', 0, null).get_symbolic_icon();
- } catch(e if e instanceof Gio.IOErrorEnum){
- if(!file.is_native()){
View delft-convex.xml
<?xml version="1.0" encoding="utf-8"?>
<CityModel xmlns="http://www.opengis.net/citygml/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xAL="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gml="http://www.opengis.net/gml"
xmlns:bldg="http://www.opengis.net/citygml/building/2.0"
xmlns:wtr="http://www.opengis.net/citygml/waterbody/2.0"
xmlns:veg="http://www.opengis.net/citygml/vegetation/2.0"
xmlns:dem="http://www.opengis.net/citygml/relief/2.0"
View diff-with-chunks.go
package main
func printDiff(suppressedKinds []string, kind string, context int, before, after string, to io.Writer) {
diffs := difflib.Diff(strings.Split(before, "\n"), strings.Split(after, "\n"))
for _, ckind := range suppressedKinds {
if ckind == kind {
str := fmt.Sprintf("+ Changes suppressed on sensitive content of type %s\n", kind)
fmt.Fprintf(to, ansi.Color(str, "yellow"))
return
View terraform-ec2-ebs.tf
variable "aws_access_key" {}
variable "aws_secret_key" {}
terraform {
required_version = "~> 0.10.8"
}
provider "aws" {
version = "~> 1.1.0"
region = "eu-central-1"
@njam
njam / asyncio_pool.py
Created Oct 13, 2017
Limit number of concurrently running asyncio tasks
View asyncio_pool.py
import asyncio
from collections import deque
class AsyncioPool:
def __init__(self, concurrency, loop=None):
"""
@param loop: asyncio loop
@param concurrency: Maximum number of concurrently running tasks
"""
View imagemagick.php
<?php
Imagick::setResourceLimit(Imagick::RESOURCETYPE_AREA, 180 * 135 * 24);
Imagick::setResourceLimit(Imagick::RESOURCETYPE_DISK, 0);
$op = function () {
echo "Reading..\n";
$path = __DIR__ . '/animated.gif';
$imagick = new Imagick();
@njam
njam / arch-linux
Last active Jun 26, 2019
Install Arch Linux on XPS 13 9360
View arch-linux
# Installation on Dell XPS
# Please also consult official documentation:
# https://wiki.archlinux.org/index.php/Installation_Guide
# https://wiki.archlinux.org/index.php/Dell_XPS_13_(9360)
# https://wiki.archlinux.org/index.php/Dell_XPS_15_(9550)
# Enter BIOS with F2 and configure:
# - "System Configuration" > "SATA Operation": "AHCI"
# - "Secure Boot" > "Secure Boot Enable": "Disabled"
View mail.php
<?php
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('mail.log', '/tmp/php-mail.log');
ob_start();
set_error_handler(function ($errno, $errstr) {
echo "ERROR: ${errno} - ${errstr}\n";
View keybase.md

Keybase proof

I hereby claim:

  • I am njam on github.
  • I am njam (https://keybase.io/njam) on keybase.
  • I have a public key ASC-YBOm7q4wL-uRQU9id9E7Z4dRkDiF8Dqn1q5gL6341Ao

To claim this, I am signing this object:

You can’t perform that action at this time.