This file contains hidden or 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
#!/bin/bash | |
unknown_os () | |
{ | |
echo "Unfortunately, your operating system distribution and version are not supported by this script." | |
echo | |
echo "You can override the OS detection by setting os= and dist= prior to running this script." | |
echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version" | |
echo | |
echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
// tsConvert convert timestamp in "YYYY-MM-DDTHH:MM" format from one timezone to another | |
func tsConvert(ts string, fromTZ string, toTZ string) (string, error) { | |
la, _ := time.LoadLocation(fromTZ) |
This file contains hidden or 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
package findgo | |
import ( | |
"io/fs" | |
"path/filepath" | |
) | |
func Files(folder fs.FS) int { | |
var count int | |
fs.WalkDir(folder, ".", func(p string, d fs.DirEntry, err error) error { |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
) | |
type Animal interface { | |
Speak() string | |
} |
This file contains hidden or 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
package main | |
func main() { | |
// if ipt, err := iptables.NewWithProtocol(iptables.ProtocolIPv4); err == nil { | |
// rule := []string{"-m", "ttl", "--ttl-eq", "1", "-p", "tcp", "-d", raddr.IP.String(), "--dport", fmt.Sprint(raddr.Port), "-j", "DROP"} | |
// if exists, err := ipt.Exists("filter", "OUTPUT", rule...); err == nil { | |
// if !exists { | |
// if err = ipt.Append("filter", "OUTPUT", rule...); err == nil { | |
// conn.iprule = rule | |
// conn.iptables = ipt |
This file contains hidden or 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
package practice; | |
import java.util.Random; | |
import java.util.Scanner; | |
public class RockPaperScissors { | |
public static void main(String... args) { | |
Scanner sc = new Scanner(System.in); | |
Random r = new Random(); |
This file contains hidden or 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
use rand::Rng; | |
use std::cmp::Ordering; | |
use std::io; | |
fn main() { | |
println!("Guess the number!"); | |
let secret_number = rand::thread_rng().gen_range(1..101); | |
loop { |
This file contains hidden or 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
--- | |
- name: install and start jenkins | |
hosts: web | |
become: yes | |
tasks: | |
- name: add redhat-stable jenkins repo | |
ansible.builtin.get_url: | |
url: https://pkg.jenkins.io/redhat-stable/jenkins.repo | |
dest: /etc/yum.repos.d/jenkins.repo |
This file contains hidden or 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
# For more information on configuration, see: | |
# * Official English Documentation: http://nginx.org/en/docs/ | |
# * Official Russian Documentation: http://nginx.org/ru/docs/ | |
user nginx; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log; | |
pid /run/nginx.pid; | |
# Load dynamic modules. See /usr/share/nginx/README.dynamic. |
This file contains hidden or 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
// requires Vue.js and Bootstrap | |
Vue.component('asteroid-grid', { | |
props: ['asteroids', 'header'], | |
data: function () { | |
return { | |
showSummary: true | |
} | |
}, | |
computed: { | |
numAsteroids: function () { |
NewerOlder