This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# notify works on ubuntu (libnotify library) | |
from sys import argv | |
import time | |
import subprocess | |
import threading | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib2 import urlopen | |
import json | |
release_response = urlopen("https://api.github.com/repos/atom/atom/releases") | |
release_data = json.load(release_response) | |
def deburl(assets): | |
for asset in assets: | |
if asset["content_type"] == "application/x-debian-package": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################### | |
# - Conky settings - # | |
###################### | |
update_interval 1 | |
total_run_times 0 | |
net_avg_samples 1 | |
cpu_avg_samples 1 | |
if_up_strictness link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const {WebhookClient} = require('dialogflow-fulfillment'); | |
const {Card, Suggestion} = require('dialogflow-fulfillment'); | |
process.env.DEBUG = 'dialogflow:debug'; | |
var processWebhook = function(request, response) { | |
const agent = new WebhookClient({ request, response }); | |
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); | |
console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://codebriefly.com/unique-alphanumeric-string-php/ | |
function unique_code($id, $limit) | |
{ | |
$randomId = $id . mt_rand(); | |
return substr(base_convert(sha1(uniqid($randomId)), 16, 36), 0, $limit); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# toggle gnome night light | |
if [ $(dconf read /org/gnome/settings-daemon/plugins/color/night-light-enabled) = true ] | |
then | |
dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled false | |
else | |
dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled true | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function trans($text, $data, $data_format = "[%s]") | |
{ | |
$dataWithFormattedKeys = []; | |
array_map(function($key, $value) use ($data_format, &$dataWithFormattedKeys) { | |
$formattedKey = sprintf($data_format, $key); | |
$dataWithFormattedKeys[$formattedKey] = $value; | |
}, array_keys($data), $data); | |
return strtr($text, $dataWithFormattedKeys); |