Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
ZiTAL / ssh_no_passwd.sh
Created May 11, 2020
ssh: login with no passwd
View ssh_no_passwd.sh
ssh-keygen
ssh-copy-id user@remoteserver
ssh user@remoteserver
@ZiTAL
ZiTAL / index.php
Last active Jun 29, 2020
php: telegram bot api example
View index.php
<?php
// get API KEY: https://core.telegram.org/bots#botfather
// get chad id: http://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user
$api_key = 'FAKE1234';
$chat_id = '7850602'
$url = "https://api.telegram.org/bot".$api_key."/";
// UNCOMMENT desired method
@ZiTAL
ZiTAL / random-near-numbers.js
Created Jun 19, 2020
js: random near numbers
View random-near-numbers.js
class RandomNearNumbersClass
{
_random(min, max)
{
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
_getMinMax(value, amount, min, max)
{
let _min = value - amount;
@ZiTAL
ZiTAL / 01.sh
Last active Jun 17, 2020
lit-element: webpack example
View 01.sh
mkdir -p /home/projects/lit/src/components
cd /home/projects/lit
npm init -y
npm install lit-element webpack webpack-cli --save-dev
touch index.html
touch src/index.js
touch src/components/progress-bar.js
@ZiTAL
ZiTAL / polymer_cli_install.sh
Last active Jun 17, 2020
js: install polymer-cli globally
View polymer_cli_install.sh
npm install -g polymer-cli --unsafe-perm
@ZiTAL
ZiTAL / promise_loop_timeout.js
Last active Jun 16, 2020
js: Promise loop timeout
View promise_loop_timeout.js
var p = new Promise(function(resolve, reject)
{
resolve();
});
for(var r='', i=0; i<3; i++)
{
(function(_i)
{
p = p.then(function()
@ZiTAL
ZiTAL / index.html
Created Jun 10, 2020
js: count down progress bar
View index.html
<!DOCTYPE html>
<html>
<style>
#myProgress {
width: 100%;
background-color: #ddd;
}
#myBar {
height: 30px;
@ZiTAL
ZiTAL / certificate_renew.sh
Created Jun 9, 2020
apache: letsencrypt auto renew
View certificate_renew.sh
#!/bin/bash
/etc/init.d/apache2 stop
/opt/letsencrypt/letsencrypt-auto renew
/etc/init.d/apache2 start
@ZiTAL
ZiTAL / hosts
Created May 26, 2020
nginx: proxy to local domain
View hosts
# /etc/hosts
127.0.0.1 localhost main.zital main01.zital
@ZiTAL
ZiTAL / a_bluetooth.sh
Last active May 18, 2020
debian: pair bluetooth audio device
View a_bluetooth.sh
su
apt install bluetooth pulseaudio-module-bluetooth
/etc/init.d/bluetooth stop
pactl unload-module module-bluetooth-discover
pactl load-module module-bluetooth-discover
/etc/init.d/bluetooth start
exit
bluetoothctl
[bluetooth]# untrust F8:DF:15:C7:1C:3D
You can’t perform that action at this time.